<script>
  let { health, selected, select, part } = $props();
  let selectedClass = $derived(selected === part ? 'selected' : '');
  let extraStyle = $derived(`color: color-mix(in lch, #090 ${health[part]*100}%, #900)`);
</script>

<span class="bodypart {selectedClass}" style={extraStyle} onclick={select(part)}>
  <slot />
</span>

<style>  
</style>
